import os
import numpy as np
from pickle_utils import load_variable


# ============ 改这里 =============
root_path = 'mycnn-20wildlife'
# root_path = 'resnet50-20wildfile-no-pretrained'
# root_path = 'resnet50-20wildfile-pretrained'
# ================================

print('-' * 70)
print('root_path:', root_path)
print('-' * 70)
eval_info = os.path.join(root_path, 'eval_info.pkl')
eval_info = load_variable(eval_info)
print(eval_info.keys())
train_acc = eval_info['train_acc']
test_acc = eval_info['test_acc']
cm_train = eval_info['cm_train']
cm_test = eval_info['cm_test']
print('train acc: %.2f %%' % (train_acc * 100))
print('train confusion matrix:' + '\n' + np.array_str(cm_train, max_line_width=100))
print('test_acc: %.2f %%' % (test_acc * 100))
print('test confusion matrix:' + '\n' + np.array_str(cm_test, max_line_width=100))


# train_accs = os.path.join(root_path, 'train_accs.pkl')
# train_accs = load_variable(train_accs)
# print('train_accs:', train_accs, sep='\n')
# test_accs = os.path.join(root_path, 'test_accs.pkl')
# test_accs = load_variable(test_accs)
# print('test_accs:', test_accs, sep='\n')
